package com.example.common.po;

import com.baomidou.mybatisplus.annotation.*;
import com.example.common.enums.ExpressEnum;
import com.example.common.enums.OrderStatusEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * 订单表
 *
 * @TableName sp_order
 */
@TableName(value = "sp_order")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderPO implements Serializable {
    @ApiModelProperty(value = "订单id", example = "1")
    @TableId(type = IdType.AUTO)
    private Integer orderId;

    @ApiModelProperty(value = "订单关联用户id", example = "1")
    private Integer userId;

    @ApiModelProperty(value = "订单号", example = "SN17119546173992864")
    private String orderCode;

    @ApiModelProperty(value = "订单金额", example = "10.00")
    private BigDecimal orderPrice;

    @ApiModelProperty(value = "支付金额", example = "10.00")
    private BigDecimal paymentAmount;

    @ApiModelProperty(value = "省id", example = "1")
    private Integer provinceId;

    @ApiModelProperty(value = "市id", example = "1")
    private Integer cityId;

    @ApiModelProperty(value = "区id", example = "1")
    private Integer districtId;

    @ApiModelProperty(value = "收货人名称", example = "半夏")
    private String addressName;

    @ApiModelProperty(value = "收货人手机号码", example = "13800000001")
    private String addressMobile;

    @ApiModelProperty(value = "收货地址", example = "上海浦东新区")
    private String orderAddress;

    @ApiModelProperty(value = "客户备注", example = "半夏很棒😊")
    private String clientRemark;

    @ApiModelProperty(value = "系统备注", example = "半夏很棒😊")
    private String systemRemark;

    @ApiModelProperty(value = "订单状态", example = "")
    private OrderStatusEnum orderStatus;

    @ApiModelProperty(value = "快递方式", example = "ExpressEnum.class")
    private ExpressEnum expressType;

    @ApiModelProperty(value = "快递编号", example = "SF10086")
    private String expressCode;

    @ApiModelProperty(value = "发货时间", example = "1712044831")
    private Integer expressTime;

    @ApiModelProperty(value = "收货时间", example = "1712044831")
    private Integer deliveryTime;

    @ApiModelProperty(value = "支付时间", example = "1712044831")
    private Integer payTime;

    @ApiModelProperty(value = "更新时间", example = "1712044831")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateTime;

    @ApiModelProperty(value = "创建时间", example = "1712044831")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        OrderPO orderPO = (OrderPO) o;
        return Objects.equals(orderId, orderPO.orderId) && Objects.equals(userId, orderPO.userId) && Objects.equals(orderCode, orderPO.orderCode) && Objects.equals(orderPrice, orderPO.orderPrice) && Objects.equals(paymentAmount, orderPO.paymentAmount) && Objects.equals(provinceId, orderPO.provinceId) && Objects.equals(cityId, orderPO.cityId) && Objects.equals(districtId, orderPO.districtId) && Objects.equals(addressName, orderPO.addressName) && Objects.equals(addressMobile, orderPO.addressMobile) && Objects.equals(orderAddress, orderPO.orderAddress) && Objects.equals(clientRemark, orderPO.clientRemark) && Objects.equals(systemRemark, orderPO.systemRemark) && orderStatus == orderPO.orderStatus && expressType == orderPO.expressType && Objects.equals(expressCode, orderPO.expressCode) && Objects.equals(expressTime, orderPO.expressTime) && Objects.equals(deliveryTime, orderPO.deliveryTime) && Objects.equals(payTime, orderPO.payTime) && Objects.equals(updateTime, orderPO.updateTime) && Objects.equals(createTime, orderPO.createTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(orderId, userId, orderCode, orderPrice, paymentAmount, provinceId, cityId, districtId, addressName, addressMobile, orderAddress, clientRemark, systemRemark, orderStatus, expressType, expressCode, expressTime, deliveryTime, payTime, updateTime, createTime);
    }

    @Override
    public String toString() {
        return "OrderPO{" +
                "orderId=" + orderId +
                ", userId=" + userId +
                ", orderCode='" + orderCode + '\'' +
                ", orderPrice=" + orderPrice +
                ", paymentAmount=" + paymentAmount +
                ", provinceId=" + provinceId +
                ", cityId=" + cityId +
                ", districtId=" + districtId +
                ", addressName='" + addressName + '\'' +
                ", addressMobile='" + addressMobile + '\'' +
                ", orderAddress='" + orderAddress + '\'' +
                ", clientRemark='" + clientRemark + '\'' +
                ", systemRemark='" + systemRemark + '\'' +
                ", orderStatus=" + orderStatus +
                ", expressType=" + expressType +
                ", expressCode='" + expressCode + '\'' +
                ", expressTime=" + expressTime +
                ", deliveryTime=" + deliveryTime +
                ", payTime=" + payTime +
                ", updateTime=" + updateTime +
                ", createTime=" + createTime +
                '}';
    }
}